/*
 * Copyright @ 2025 weili23
 * com.example.ai.config 11:46
 * All right reserved.
 */


package com.example.ai.config;

import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import dev.langchain4j.store.memory.chat.InMemoryChatMemoryStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @desc:会话隔离配置
 * @author: weili23
 * @createTime: 2025/4/29 11:46
 * @version: v1.0
 */

@Configuration
public class SeparateChatAssistantConfig {
    @Autowired
    private MongoDbChatMemoryConfig mongoDbChatMemoryConfig;
    @Bean("chatMemoryProviderSep")
    public ChatMemoryProvider  chatMemoryProviderSep(){
        return memoryId-> MessageWindowChatMemory
                .builder()
                .id(memoryId)
                .maxMessages(10)
                //.chatMemoryStore(new InMemoryChatMemoryStore())
                .chatMemoryStore(mongoDbChatMemoryConfig)
                .build();
    }
}
